<? if (!defined("B_PROLOG_INCLUDED") || (B_PROLOG_INCLUDED==false)) die();?>

<?
function SelectElement($sortOrder,$sortFilter,$xz,$count,$elements){
    if (CModule::IncludeModule("iblock")):
        $result=array();
        $rDb= CIBlockElement::GetList($sortOrder,$sortFilter,$xz,array("nTopCount"=>$count),$elements);
        while($res=$rDb->GetNext()):
            $result[]=$res;
        endwhile;
        return $result;
    else:
        return false;
    endif;
}


    $arElements = SelectElement(array("DATE_CREATE_UNIX"=>"desc"),
                                array("IBLOCK_TYPE"=>"info","IBLOCK_CODE"=>"baners","ACTIVE"=>"Y"),
                                false,
                                4, // count
                                array("ID","PREVIEW_TEXT","PREVIEW_PICTURE","PROPERTY_LINK")     );
    for ($id = 0; $id<count($arElements); $id++):
        $arElements[$id]["PREVIEW_PICTURE"] = CFile::getPath($arElements[$id]["PREVIEW_PICTURE"]);
    endfor;
?>

                    <div id="slide">
                    	<ul>
                            
                                <? foreach($arElements as $baner):?>
                                    <?$img_src = $APPLICATION->IncludeComponent("soulstream:imager", "", Array(
                                                                                 "MODE" => "3",
                                                                                 "RETURN" => "src",
                                                                                 "FILTERTYPE" => "",
                                                                                 "RESIZE_SMALL" => "Y",
                                                                                 "IMAGE" => $baner['PREVIEW_PICTURE'],
                                                                                 "FILE_NAME" => "",
                                                                                 "SAVE_DIR" => "/upload/imager/",
                                                                                 "WIDTH" => "580",
                                                                                 "HEIGHT" => "270",
                                                                                 "BG" => "",
                                                                                 "QUALITY" => "75",
                                                                                 "ADD_WATERMARK" => "N",
                                                                                 "WATERMARK_PATH" => "",
                                                                                 "WATERMARK_POSITION" => "",
                                                                                 "ADD_CORNER" => "N",
                                                                                 "CORNER_PATH" => "",
                                                                                 "ADD_TEXT" => "N",
                                                                                 "TEXT" => "",
                                                                                 "TEXT_SIZE" => "12",
                                                                                 "TEXT_COLOR" => "#000000",
                                                                                 "TEXT_Y" => "10",
                                                                                 "TEXT_X" => "10",
                                                                                 "TEXT_POSITION" => "br",
                                                                                 "TEXT_ANGLE" => "15",
                                                                                 "FONT_PATH" => "/imager/arial.ttf",
                                                                                 "CACHE_IMAGE" => "Y",
                                                                                 "DEBUG" => "N"
                                                                                        ), false, array("HIDE_ICONS"=>"Y"));
                                 ?>
                                
                                
                                
                                
                                
                                    <li>
                                        <a href="<?=$baner["PROPERTY_LINK_VALUE"];?>">
                                            <img src="<?=$img_src;?>" width="100%" alt="<?=$baner['PREVIEW_TEXT'];?>"/>
                                        </a>
                                    </li>
                            
                                <? endforeach;?>
                        </ul>
                        
                    </div>